<template>
  <view class="category-container">
    <view class="header-section">
      <text class="title">{{ categoryObj.name }}</text>
    </view>
    <view class="list-section">
      <view v-for="(item, index) in categoryObj.children" class="list-item">
        <image
          class="item-img"
          :src="'http://sit-store.lai-do.com/storeservice/fileStore/downloadFile.json?id=' + item.storeId"
          mode="aspectFill"
        ></image>
        <text class="item-title">{{ item.name }}</text>
      </view>
    </view>
  </view>
</template>

<script lang="ts" setup>
const emit = defineEmits(['itemTap'])
const props = defineProps({
  categoryObj: {
    type: Object,
    default: () => {}
  },
  selectIndex: {
    type: Number,
    default: 0
  }
})
</script>

<style lang="scss" scoped>
.category-container {
  background-color: #fff;
  border-radius: 20upx;

  .header-section {
    padding: 20upx;

    .title {
      color: #333;
      font-size: 26upx;
      font-weight: 600;
    }
  }

  .list-section {
    display: flex;
    flex-wrap: wrap;

    .list-item {
      display: flex;
      flex-direction: column;
      justify-content: center;
      align-items: center;
      width: calc(100% / 3);
      padding-bottom: 30upx;

      .item-img {
        width: 88px;
        height: 88px;
        border-radius: 10px;
      }

      .item-title {
        font-size: 24upx;
        color: #666;
        margin-top: 10upx;
      }
    }
  }
}
</style>
